package com.example.housingRentalSystem.mapper;

import com.example.housingRentalSystem.bean.Role;
import com.example.housingRentalSystem.bean.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 王硕
 * @version jdk21
 * @className UserMapper
 * @description
 * @date 2025/3/14 9:28
 */
@Mapper
public interface UserMapper {

    User findByAccount(String account);

    void insert(User user);

    List<Role> findRolesByUserId(@Param("userId") Integer userId);

    void resetPwd(User user);

    int updatePassword(User user);

    int updateUserInfo(User user);

    User findUserInfoByAccount(String account);

    int updateAvatar(@Param("account") String account, @Param("avatar") String avatar);

    List<User> findUsersByRoleName(@Param("roleName") String roleName);

    int updateUserStatus(@Param("userId") Integer userId, @Param("status") Integer status);

    int resetUserPassword(@Param("userId") Integer userId, @Param("password") String password);

    int selectUserCount();
}